/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package itcast;

import java.util.Random;

/**
 * <p>Project: JavaStudy - Rand2
 * <p>Powered by jiangbo On 2023-02-04
 * 16:41:39
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class Rand2 {
    public static void main(String[] args) {
        System.out.println(System.getProperty("java.version"));
//java.util.Date Calendar Scanner
//java.util.Random java.util java官方的工具包
//（1）实例化
        Random rand = new Random();
//（2）使用
        System.out.println(rand.nextBoolean());
        /*System.out.println("*".repeat(35));
        for (int i=0; i<100;i++){
        }
        System.out.println("*".repeat(35));*/
        System.out.println(rand.nextDouble());
        System.out.println(rand.nextDouble(5));
        System.out.println(rand.nextDouble(5,10));
//0-5 不包含5，之间的随机整数0 -4
        System.out.println(rand.nextInt(5));
//1-100 的随机整数
        System.out.println(rand.nextInt(1,101));
//利用循环语句，特殊5次，获取并输出5个随机整数（1-2）
        for (int i = 0; i < 5; i++) {
            System.out.println(rand.nextInt(1,3));
        }
    }
}


